using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._SpaceTimePatternMiningTools._SpaceTimeCubeCreation
{
    /// <summary>
    /// <para>Create Space Time Cube By Aggregating Points</para>
    /// <para>Summarizes a set of points into a netCDF data structure by aggregating them into space-time bins.  Within each bin, the points are counted, and specified attributes are aggregated.  For all bin locations, the trend for counts and summary field values are evaluated.</para>
    /// <para>通过将一组点聚合到时空箱中，将一组点汇总到 netCDF 数据结构中。 在每个条柱中，对点进行计数，并聚合指定的属性。 对于所有库位，将评估计数趋势和汇总字段值。</para>
    /// </summary>    
    [DisplayName("Create Space Time Cube By Aggregating Points")]
    public class CreateSpaceTimeCube : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public CreateSpaceTimeCube()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_features">
        /// <para>Input Features</para>
        /// <para>The input point feature class to be aggregated into space-time bins.</para>
        /// <para>要聚合到时空图格中的输入点要素类。</para>
        /// </param>
        /// <param name="_output_cube">
        /// <para>Output Space Time Cube</para>
        /// <para>The output netCDF data cube that will be created to contain counts and summaries of the input feature point data.</para>
        /// <para>将创建的输出 netCDF 数据多维数据集，用于包含输入要素点数据的计数和摘要。</para>
        /// </param>
        /// <param name="_time_field">
        /// <para>Time Field</para>
        /// <para>The field containing the date and time (timestamp) for each point. This field must be of type Date.</para>
        /// <para>包含每个点的日期和时间（时间戳）的字段。此字段的类型必须为“日期”。</para>
        /// </param>
        public CreateSpaceTimeCube(object _in_features, object _output_cube, object _time_field)
        {
            this._in_features = _in_features;
            this._output_cube = _output_cube;
            this._time_field = _time_field;
        }
        public override string ToolboxName => "Space Time Pattern Mining Tools";

        public override string ToolName => "Create Space Time Cube By Aggregating Points";

        public override string CallName => "stpm.CreateSpaceTimeCube";

        public override List<string> AcceptEnvironments => ["extent", "geographicTransformations", "outputCoordinateSystem", "parallelProcessingFactor", "scratchWorkspace", "workspace"];

        public override object[] ParameterInfo => [_in_features, _output_cube, _time_field, _template_cube, _time_step_interval, _time_step_alignment.GetGPValue(), _reference_time, _distance_interval, _summary_fields, _aggregation_shape_type.GetGPValue(), _defined_polygon_locations, _location_id];

        /// <summary>
        /// <para>Input Features</para>
        /// <para>The input point feature class to be aggregated into space-time bins.</para>
        /// <para>要聚合到时空图格中的输入点要素类。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Features")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_features { get; set; }


        /// <summary>
        /// <para>Output Space Time Cube</para>
        /// <para>The output netCDF data cube that will be created to contain counts and summaries of the input feature point data.</para>
        /// <para>将创建的输出 netCDF 数据多维数据集，用于包含输入要素点数据的计数和摘要。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Space Time Cube")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _output_cube { get; set; }


        /// <summary>
        /// <para>Time Field</para>
        /// <para>The field containing the date and time (timestamp) for each point. This field must be of type Date.</para>
        /// <para>包含每个点的日期和时间（时间戳）的字段。此字段的类型必须为“日期”。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Time Field")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _time_field { get; set; }


        /// <summary>
        /// <para>Template Cube</para>
        /// <para><xdoc>
        ///   <para>A reference space-time cube used to define the Output Space Time Cube extent of analysis, bin dimensions, and bin alignment. Time Step Interval, Distance Interval, and Reference Time information are also obtained from the template cube. This template cube must be a netCDF (.nc) file that has been created using this tool.</para>
        ///   <para>A space-time cube created by aggregating into Defined locations cannot be used as a Template Cube.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>一个参考时空立方体，用于定义输出时空立方体的分析范围、图格尺寸和图格对齐方式。时间步长间隔、距离间隔和参考时间信息也从模板多维数据集中获取。此模板多维数据集必须是使用此工具创建的 netCDF （.nc） 文件。</para>
        ///   <para>通过聚合到定义位置创建的时空立方体不能用作模板立方体。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Template Cube")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _template_cube { get; set; } = null;


        /// <summary>
        /// <para>Time Step Interval</para>
        /// <para>The number of seconds, minutes, hours, days, weeks, or years that will represent a single time step. All points within the same Time Step Interval and Distance Interval will be aggregated. (When a Template Cube is provided, this parameter is ignored, and the Time Step Interval value is obtained from the template cube.)</para>
        /// <para>表示单个时间步长的秒数、分钟数、小时数、天数、周数或年数。将聚合同一时间步长间隔和距离间隔内的所有点。（提供模板多维数据集时，将忽略此参数，并从模板多维数据集中获取时间步长间隔值。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Time Step Interval")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _time_step_interval { get; set; } = null;


        /// <summary>
        /// <para>Time Step Alignment</para>
        /// <para><xdoc>
        ///   <para>Defines how aggregation will occur based on a given Time Step Interval. If a Template Cube is provided, the Time Step Alignment associated with the Template Cube overrides this parameter setting and the Time Step Alignment of the Template Cube is used.</para>
        ///   <bulletList>
        ///     <bullet_item>End time—Time steps align to the last time event and aggregate back in time.</bullet_item><para/>
        ///     <bullet_item>Start time—Time steps align to the first time event and aggregate forward in time.</bullet_item><para/>
        ///     <bullet_item>Reference time—Time steps align to a particular date/time that you specify. If all points in the input features have a timestamp larger than the Reference time you provide (or it falls exactly on the start time of the input features), the time-step interval will begin with that reference time and aggregate forward in time (as occurs with a Start time alignment). If all points in the input features have a timestamp smaller than the reference time you provide (or it falls exactly on the end time of the input features), the time-step interval will end with that reference time and aggregate backward in time (as occurs with an End time alignment). If the Reference time you provide is in the middle of the time extent of your data, a time-step interval will be created ending with the reference time provided (as occurs with an End time alignment); additional intervals will be created both before and after the reference time until the full time extent of your data is covered.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>定义如何根据给定的时间步长间隔进行聚合。如果提供了模板多维数据集，则与模板多维数据集关联的时间步长对齐将覆盖此参数设置，并使用模板多维数据集的时间步长对齐方式。</para>
        ///   <bulletList>
        ///     <bullet_item>结束时间 - 时间步长与上次时间事件对齐，并按时间聚合回程。</bullet_item><para/>
        ///     <bullet_item>开始时间 - 时间步长与首次时间事件对齐，并在时间上向前聚合。</bullet_item><para/>
        ///     <bullet_item>参考时间 - 时间步长与您指定的特定日期/时间对齐。如果输入要素中所有点的时间戳都大于您提供的参考时间（或者正好落在输入要素的开始时间上），则时间步长间隔将从该参考时间开始，并在时间上向前聚合（与开始时间对齐一样）。如果输入要素中所有点的时间戳都小于您提供的参考时间（或者正好落在输入要素的结束时间），则时间步长间隔将以该参考时间结束，并在时间上向后聚合（如结束时间对齐）。如果您提供的参考时间位于数据时间范围的中间，则将创建一个以提供的参考时间结尾的时间步长间隔（与结束时间对齐一样）;将在参考时间之前和之后创建其他时间间隔，直到覆盖数据的完整时间范围。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Time Step Alignment")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _time_step_alignment_value _time_step_alignment { get; set; } = _time_step_alignment_value._END_TIME;

        public enum _time_step_alignment_value
        {
            /// <summary>
            /// <para>End time</para>
            /// <para>End time—Time steps align to the last time event and aggregate back in time.</para>
            /// <para>结束时间 - 时间步长与上次时间事件对齐，并按时间聚合回程。</para>
            /// </summary>
            [Description("End time")]
            [GPEnumValue("END_TIME")]
            _END_TIME,

            /// <summary>
            /// <para>Start time</para>
            /// <para>Start time—Time steps align to the first time event and aggregate forward in time.</para>
            /// <para>开始时间 - 时间步长与首次时间事件对齐，并在时间上向前聚合。</para>
            /// </summary>
            [Description("Start time")]
            [GPEnumValue("START_TIME")]
            _START_TIME,

            /// <summary>
            /// <para>Reference time</para>
            /// <para>Reference time—Time steps align to a particular date/time that you specify. If all points in the input features have a timestamp larger than the Reference time you provide (or it falls exactly on the start time of the input features), the time-step interval will begin with that reference time and aggregate forward in time (as occurs with a Start time alignment). If all points in the input features have a timestamp smaller than the reference time you provide (or it falls exactly on the end time of the input features), the time-step interval will end with that reference time and aggregate backward in time (as occurs with an End time alignment). If the Reference time you provide is in the middle of the time extent of your data, a time-step interval will be created ending with the reference time provided (as occurs with an End time alignment); additional intervals will be created both before and after the reference time until the full time extent of your data is covered.</para>
            /// <para>参考时间 - 时间步长与您指定的特定日期/时间对齐。如果输入要素中所有点的时间戳都大于您提供的参考时间（或者正好落在输入要素的开始时间上），则时间步长间隔将从该参考时间开始，并在时间上向前聚合（与开始时间对齐一样）。如果输入要素中所有点的时间戳都小于您提供的参考时间（或者正好落在输入要素的结束时间），则时间步长间隔将以该参考时间结束，并在时间上向后聚合（如结束时间对齐）。如果您提供的参考时间位于数据时间范围的中间，则将创建一个以提供的参考时间结尾的时间步长间隔（与结束时间对齐一样）;将在参考时间之前和之后创建其他时间间隔，直到覆盖数据的完整时间范围。</para>
            /// </summary>
            [Description("Reference time")]
            [GPEnumValue("REFERENCE_TIME")]
            _REFERENCE_TIME,

        }

        /// <summary>
        /// <para>Reference Time</para>
        /// <para>The date/time to use to align the time-step intervals. If you want to bin your data weekly from Monday to Sunday, for example, you could set a reference time of Sunday at midnight to ensure bins break between Sunday and Monday at midnight. (When a Template Cube is provided, this parameter is disabled and the Reference Time is based on the Template Cube.)</para>
        /// <para>用于对齐时间步长间隔的日期/时间。例如，如果要每周从周一到周日对数据进行分箱，则可以将参考时间设置为周日午夜，以确保在周日和周一午夜之间中断数据箱。（提供模板立方体时，禁用此参数，参考时间基于模板立方体。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Reference Time")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _reference_time { get; set; } = null;


        /// <summary>
        /// <para>Distance Interval</para>
        /// <para>The size of the bins used to aggregate the Input Features. All points that fall within the same Distance Interval and Time Step Interval will be aggregated. When aggregating into a hexagon grid, this distance is used as the height to construct the hexagon polygons. (When a Template Cube is provided, this parameter is disabled and the distance interval value will be based on the Template Cube.)</para>
        /// <para>用于聚合输入要素的条柱大小。将聚合位于同一距离间隔和时间步长间隔内的所有点。聚合到六边形网格中时，此距离用作构造六边形多边形的高度。（提供模板立方体时，此参数将被禁用，距离间隔值将基于模板立方体。</para>
        /// <para>单位： Feet | Meters | Kilometers | Miles </para>
        /// </summary>
        [DisplayName("Distance Interval")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public string? _distance_interval { get; set; } = null;


        /// <summary>
        /// <para>Summary Fields</para>
        /// <para><xdoc>
        ///   <para>The numeric field containing attribute values used to calculate the specified statistic when aggregating into a space-time cube. Multiple statistic and field combinations can be specified. Null values in any of the fields specified will result in that feature being dropped from the output cube. If there are null values present in your input features, it is highly recommended that you run the Fill Missing Values tool before creating a space-time cube.</para>
        ///   <para>Available statistic types are:
        ///   <bulletList>
        ///     <bullet_item>SUM-Adds the total value for the specified field within each bin.  </bullet_item><para/>
        ///     <bullet_item>MEAN-Calculates the average for the specified field within each bin.  </bullet_item><para/>
        ///     <bullet_item>MIN-Finds the smallest value for all records of the specified field within each bin.  </bullet_item><para/>
        ///     <bullet_item>MAX-Finds the largest value for all records of the specified field within each bin.  </bullet_item><para/>
        ///     <bullet_item>STD-Finds the standard deviation on values in the specified field within each bin.  </bullet_item><para/>
        ///     <bullet_item>MEDIAN-Finds the sorted middle value of all records of the specified field within each bin.  </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        ///   <para>Available fill types are:
        ///   <bulletList>
        ///     <bullet_item>ZEROS-Fills empty bins with zeros.  </bullet_item><para/>
        ///     <bullet_item>SPATIAL_NEIGHBORS-Fills empty bins with the average value of spatial neighbors  </bullet_item><para/>
        ///     <bullet_item>SPACE_TIME_NEIGHBORS-Fills empty bins with the average value of space time neighbors.  </bullet_item><para/>
        ///     <bullet_item>TEMPORAL_TREND-Fills empty bins using an interpolated univariate spline algorithm.  </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        ///   <para>Null values present in any of the summary field records will result in those features being excluded from the output cube. If there are null values present in your Input Features, it is highly recommended that you run the Fill Missing Values tool first. If, after running the Fill Missing Values tool, there are still null values present and having the count of points in each bin is part of your analysis strategy, you may want to consider creating separate cubes, one for the count (without Summary Fields) and one for Summary Fields. If the set of null values is different for each summary field, you may also consider creating a separate cube for each summary field.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>包含属性值的数值字段，用于在聚合到时空立方体中时计算指定的统计数据。可以指定多个统计量和字段组合。如果指定任何字段中的空值将导致该要素从输出多维数据集中删除。如果输入要素中存在空值，强烈建议您在创建时空立方体之前运行填充缺失值工具。</para>
        /// <para>可用的统计信息类型包括：
        ///   <bulletList>
        ///     <bullet_item>SUM- 将每个图柱中指定字段的总值相加。</bullet_item><para/>
        ///     <bullet_item>MEAN - 计算每个图柱中指定字段的平均值。</bullet_item><para/>
        ///     <bullet_item>MIN - 查找每个图格中指定字段的所有记录的最小值。</bullet_item><para/>
        ///     <bullet_item>MAX - 查找每个图格中指定字段的所有记录的最大值。</bullet_item><para/>
        ///     <bullet_item>STD - 查找每个图柱中指定字段中值的标准偏差。</bullet_item><para/>
        ///     <bullet_item>MEDIAN - 查找每个图柱中指定字段的所有记录的排序中间值。</bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// <para>可用的填充类型包括：
        ///   <bulletList>
        ///     <bullet_item>ZEROS - 用零填充空箱。</bullet_item><para/>
        ///     <bullet_item>SPATIAL_NEIGHBORS - 用空间邻居的平均值填充空箱</bullet_item><para/>
        ///     <bullet_item>SPACE_TIME_NEIGHBORS - 用时空邻居的平均值填充空箱。</bullet_item><para/>
        ///     <bullet_item>TEMPORAL_TREND-使用插值单变量样条算法填充空箱。</bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        ///   <para>任何汇总字段记录中存在的空值将导致这些要素从输出多维数据集中排除。如果输入要素中存在空值，强烈建议您先运行填充缺失值工具。如果在运行“填充缺失值”工具后，仍然存在空值，并且每个图格中的点计数是分析策略的一部分，则可能需要考虑创建单独的立方体，一个用于计数（不带汇总字段），一个用于汇总字段。如果每个汇总字段的 null 值集不同，则还可以考虑为每个汇总字段创建一个单独的多维数据集。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Summary Fields")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _summary_fields { get; set; } = null;


        /// <summary>
        /// <para>Aggregation Shape Type</para>
        /// <para><xdoc>
        ///   <para>The shape of the polygon mesh into which the input feature point data will be aggregated.</para>
        ///   <bulletList>
        ///     <bullet_item>Fishnet grid—The input features will be aggregated into a grid of square (fishnet) cells.</bullet_item><para/>
        ///     <bullet_item>Hexagon grid—The input features will be aggregated into a grid of hexagonal cells.</bullet_item><para/>
        ///     <bullet_item>Defined locations—The input features will be aggregated into the locations provided.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>输入要素点数据将聚合到的面网格的形状。</para>
        ///   <bulletList>
        ///     <bullet_item>渔网格网—输入要素将聚合为方形（渔网）像元的格网。</bullet_item><para/>
        ///     <bullet_item>六边形格网—输入要素将聚合为六边形像元格网。</bullet_item><para/>
        ///     <bullet_item>定义位置—输入要素将聚合到提供的位置中。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Aggregation Shape Type")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _aggregation_shape_type_value _aggregation_shape_type { get; set; } = _aggregation_shape_type_value._FISHNET_GRID;

        public enum _aggregation_shape_type_value
        {
            /// <summary>
            /// <para>Fishnet grid</para>
            /// <para>Fishnet grid—The input features will be aggregated into a grid of square (fishnet) cells.</para>
            /// <para>渔网格网—输入要素将聚合为方形（渔网）像元的格网。</para>
            /// </summary>
            [Description("Fishnet grid")]
            [GPEnumValue("FISHNET_GRID")]
            _FISHNET_GRID,

            /// <summary>
            /// <para>Hexagon grid</para>
            /// <para>Hexagon grid—The input features will be aggregated into a grid of hexagonal cells.</para>
            /// <para>六边形格网—输入要素将聚合为六边形像元格网。</para>
            /// </summary>
            [Description("Hexagon grid")]
            [GPEnumValue("HEXAGON_GRID")]
            _HEXAGON_GRID,

            /// <summary>
            /// <para>Defined locations</para>
            /// <para>Defined locations—The input features will be aggregated into the locations provided.</para>
            /// <para>定义位置—输入要素将聚合到提供的位置中。</para>
            /// </summary>
            [Description("Defined locations")]
            [GPEnumValue("DEFINED_LOCATIONS")]
            _DEFINED_LOCATIONS,

        }

        /// <summary>
        /// <para>Defined Polygon Locations</para>
        /// <para>The polygon features into which the input point data will be aggregated. These can represent county boundaries, police beats, or sales territories for example.</para>
        /// <para>输入点数据将聚合到其中的面要素。例如，这些可以表示县边界、警察节拍或销售区域。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Defined Polygon Locations")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _defined_polygon_locations { get; set; } = null;


        /// <summary>
        /// <para>Location ID</para>
        /// <para>The field containing the ID number for each unique location.</para>
        /// <para>包含每个唯一位置的 ID 号的字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Location ID")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _location_id { get; set; } = null;


        public CreateSpaceTimeCube SetEnv(object extent = null, object geographicTransformations = null, object outputCoordinateSystem = null, object parallelProcessingFactor = null, object scratchWorkspace = null, object workspace = null)
        {
            base.SetEnv(extent: extent, geographicTransformations: geographicTransformations, outputCoordinateSystem: outputCoordinateSystem, parallelProcessingFactor: parallelProcessingFactor, scratchWorkspace: scratchWorkspace, workspace: workspace);
            return this;
        }

    }

}